/**
 * Copyright 2011 FeedDreamwork SIG
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.feeddreamwork;

import com.google.appengine.api.utils.*;

public final class ApplicationProperty {
	public static final String VERSION = System
			.getProperty("org.feeddreamwork.version");
	public static final boolean IS_DEVELOPMENT;
	public static final String HOST_NAME;
	public static final String DEFAULT_SC_DECODING = System
	.getProperty("org.feeddreamwork.defaultscdecoding");
	public static final String DEFAULT_TC_DECODING = System
	.getProperty("org.feeddreamwork.defaulttcdecoding");
	public static final String DEFAULT_ENCODING = System
			.getProperty("org.feeddreamwork.defaultencoding");
	public static final String DEFAULT_TIME_ZONE = System
			.getProperty("org.feeddreamwork.defaulttimezone");
	public static final int HTTP_RETRY_TIMES = Integer.parseInt(System
			.getProperty("org.feeddreamwork.httpretrytimes"));
	public static final int HTTP_FETCH_LIMIT = Integer.parseInt(System
			.getProperty("org.feeddreamwork.httpfetchlimit"));
	public static final int DELETE_CACHE_AFTER = Integer.parseInt(System
			.getProperty("org.feeddreamwork.deletecacheafter"));
	public static final int MIN_FREQUENCY = Integer.parseInt(System
			.getProperty("org.feeddreamwork.minfrequency"));
	public static final String HUB_URL = System
			.getProperty("org.feeddreamwork.huburl");

	static {
		String isDevelopment = System
				.getProperty("org.feeddreamwork.isdevelopment");
		if (Utils.isNullOrEmpty(isDevelopment))
			if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development)
				IS_DEVELOPMENT = true;
			else
				IS_DEVELOPMENT = false;
		else
			IS_DEVELOPMENT = Boolean.parseBoolean(isDevelopment);

		String hostName = System.getProperty("org.feeddreamwork.hostname");
		if (Utils.isNullOrEmpty(hostName))
			HOST_NAME = "http://" + SystemProperty.applicationId.get()
					+ ".appspot.com";
		else
			HOST_NAME = hostName;
	}

	private ApplicationProperty() {
	}
}
